#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
//#include <string.h> //agregado JC! 


int main( int argc, char *argv[] )
{
  char nombre[30];
  DIR *dir;
  struct dirent *mi_dirent;

  //nombre = "prueba.c";
  
  if( argc != 2 )
  {
    printf( "%s: %s directorio\n", argv[0], argv[0] );
    exit( -1 );
  }

  if( (dir = opendir( argv[1] )) == NULL )
  {
    perror( "opendir" );
    exit( -1 );
  }

  while( (mi_dirent = readdir( dir )) != NULL )
    printf( "%s\n", mi_dirent->d_name );
    
     
  closedir( dir );

  return 0;
}